<?php
 class infoController extends UserController
 {
     public function init()
     {
         parent::init();
         if ($this->userinfo['author'] != 1) {
             $this->error('您尚未申请作者或者作者申请尚未通过审核');
         }
     }
     public function editAction()
     {
         if ($this->request->isPost()) {
             $zym_5['name'] = $this->input->post('name', 'str', '');
             $zym_5['truename'] = $this->input->post('truename', 'str', '');
             $zym_5['idcard'] = $this->input->post('idcard', 'str', '');
             $zym_5['mobile'] = $this->input->post('mobile', 'str', '');
             $zym_5['pay'] = $this->input->post('pay', 'str', '');
             $zym_5['qq'] = $this->input->post('qq', 'str', '');
             if (!$zym_5['name']) {
                 $this->error('请完整填写资料');
             }
             if (false !== $this->model('author')->where(['user_id' => $this->userinfo['id']])->update($zym_5)) {
                 $this->success('修改成功');
             } else {
                 $this->error('修改失败');
             }
         }
         $this->assign('info', $this->model('author')->getinfo($this->userinfo['id']));
         $this->assign('userpagesign', 'authoredit');
         $this->display('edit');
     }
 }
